﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TaskMasterByQuartz.Domain.Entities;

namespace TaskMasterByQuartz.Infrastructure.Configs
{
    public class ExecuteLogConfiguration : IEntityTypeConfiguration<ExecuteLog>
    {
        public void Configure(EntityTypeBuilder<ExecuteLog> builder)
        {
            // 设置表名
            builder.ToTable("T_ExecuteLogs");

            // 设置主键
            builder.HasKey(el => el.Id);

            // 设置字段映射关系
            builder.Property(el => el.JobGroup).IsRequired().HasMaxLength(100);
            builder.Property(el => el.JobName).IsRequired().HasMaxLength(100);
            builder.Property(el => el.ActionContent).HasMaxLength(500); // 可以根据实际需求修改最大长度
            builder.Property(el => el.BeginTime).IsRequired();
            builder.Property(el => el.EndTime).IsRequired();
            builder.Property(el => el.ExecuteTime).IsRequired();
            builder.Property(el => el.Result).HasMaxLength(100); // 可以根据实际需求修改最大长度
            builder.Property(el => el.Statu).IsRequired();

            // 可以根据需要进行其他配置，例如关系映射、索引等
        }
    }
}
